<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class NilClass - RDoc Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0-preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-i-26">#&amp;</a>
    <li ><a href="#method-i-3D-3D-3D">#===</a>
    <li ><a href="#method-i-3D~">#=~</a>
    <li ><a href="#method-i-5E">#^</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-nil-3F">#nil?</a>
    <li ><a href="#method-i-rationalize">#rationalize</a>
    <li ><a href="#method-i-to_a">#to_a</a>
    <li ><a href="#method-i-to_c">#to_c</a>
    <li ><a href="#method-i-to_f">#to_f</a>
    <li ><a href="#method-i-to_h">#to_h</a>
    <li ><a href="#method-i-to_i">#to_i</a>
    <li ><a href="#method-i-to_r">#to_r</a>
    <li ><a href="#method-i-to_s">#to_s</a>
    <li ><a href="#method-i-7C">#|</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-NilClass">
    <h1 id="class-NilClass" class="class">
      class NilClass
    </h1>

    <section class="description">
    
<p>The class of the singleton object <code>nil</code>.</p>

<p>Several of its methods act as operators:</p>
<ul><li>
<p>#&amp;</p>
</li><li>
<p>#|</p>
</li><li>
<p><a href="NilClass.html#method-i-3D-3D-3D"><code>===</code></a></p>
</li><li>
<p>#=~</p>
</li><li>
<p>#^</p>
</li></ul>

<p>Others act as converters, carrying the concept of <em>nullity</em> to other classes:</p>
<ul><li>
<p><a href="NilClass.html#method-i-rationalize"><code>rationalize</code></a></p>
</li><li>
<p><a href="NilClass.html#method-i-to_a"><code>to_a</code></a></p>
</li><li>
<p><a href="NilClass.html#method-i-to_c"><code>to_c</code></a></p>
</li><li>
<p><a href="NilClass.html#method-i-to_h"><code>to_h</code></a></p>
</li><li>
<p><a href="NilClass.html#method-i-to_r"><code>to_r</code></a></p>
</li><li>
<p><a href="NilClass.html#method-i-to_s"><code>to_s</code></a></p>
</li></ul>

<p>Another method provides inspection:</p>
<ul><li>
<p><a href="NilClass.html#method-i-inspect"><code>inspect</code></a></p>
</li></ul>

<p>Finally, there is this query method:</p>
<ul><li>
<p><a href="NilClass.html#method-i-nil-3F"><code>nil?</code></a></p>
</li></ul>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-26" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          false &amp; object &rarr; false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          nil &amp; object   &rarr; false
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>false</code>:</p>

<pre class="ruby"><span class="ruby-keyword">false</span> <span class="ruby-operator">&amp;</span> <span class="ruby-keyword">true</span>       <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-keyword">false</span> <span class="ruby-operator">&amp;</span> <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment"># =&gt; false</span>
</pre>

<p>Argument <code>object</code> is evaluated:</p>

<pre class="ruby"><span class="ruby-keyword">false</span> <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">raise</span> <span class="ruby-comment"># Raises RuntimeError.</span>
</pre>

                              <div class="method-source-code" id="26-source">
            <pre>static VALUE
false_and(VALUE obj, VALUE obj2)
{
    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-3D-3D-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          true === other &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          false === other &rarr; true or false
                              </span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          nil === other &rarr; true or false
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> or <code>false</code>.</p>

<p>Like <a href="BasicObject.html#method-i-3D-3D"><code>Object#==</code></a>, if <code>object</code> is an instance of <a href="Object.html"><code>Object</code></a> (and not an instance of one of its many subclasses).</p>

<p>This method is commonly overridden by those subclasses, to provide meaningful semantics in <code>case</code> statements.</p>

                              <div class="method-source-code" id="3D-3D-3D-source">
            <pre>#define case_equal rb_equal</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-3D~" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          nil =~ object &rarr; nil
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>nil</code>.</p>

<p>This method makes it useful to write:</p>

<pre class="ruby"><span class="ruby-keyword">while</span> <span class="ruby-identifier">gets</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/re/</span>
  <span class="ruby-comment"># ...</span>
<span class="ruby-keyword">end</span>
</pre>

                              <div class="method-source-code" id="3D~-source">
            <pre>static VALUE
nil_match(VALUE obj1, VALUE obj2)
{
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-5E" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          false ^ object &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          nil ^ object   &rarr; true or false
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>false</code> if <code>object</code> is <code>nil</code> or <code>false</code>, <code>true</code> otherwise:</p>

<pre class="ruby"><span class="ruby-keyword">nil</span> <span class="ruby-operator">^</span> <span class="ruby-keyword">nil</span>        <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-keyword">nil</span> <span class="ruby-operator">^</span> <span class="ruby-keyword">false</span>      <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-keyword">nil</span> <span class="ruby-operator">^</span> <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment"># =&gt; true</span>
</pre>

                              <div class="method-source-code" id="5E-source">
            <pre>#define false_xor true_and</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          inspect &rarr; &#39;nil&#39;
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns string <code>&#39;nil&#39;</code>:</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-comment"># =&gt; &quot;nil&quot;</span>
</pre>

                              <div class="method-source-code" id="inspect-source">
            <pre>static VALUE
nil_inspect(VALUE obj)
{
    return rb_usascii_str_new2(&quot;nil&quot;);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-nil-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          nil?  &rarr; true
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code>. For all other objects, method <code>nil?</code> returns <code>false</code>.</p>

                              <div class="method-source-code" id="nil-3F-source">
            <pre>static VALUE
rb_true(VALUE obj)
{
    return Qtrue;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-rationalize" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          rationalize(eps = nil)  &rarr;  (0/1)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns zero as a Rational:</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">rationalize</span> <span class="ruby-comment"># =&gt; (0/1)</span>
</pre>

<p>Argument <code>eps</code> is ignored.</p>

                              <div class="method-source-code" id="rationalize-source">
            <pre>static VALUE
nilclass_rationalize(int argc, VALUE *argv, VALUE self)
{
    rb_check_arity(argc, 0, 1);
    return nilclass_to_r(self);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_a" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_a &rarr; []
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns an empty <a href="Array.html"><code>Array</code></a>.</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">to_a</span> <span class="ruby-comment"># =&gt; []</span>
</pre>

                              <div class="method-source-code" id="to_a-source">
            <pre>static VALUE
nil_to_a(VALUE obj)
{
    return rb_ary_new2(0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_c" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_c &rarr; (0+0i)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns zero as a Complex:</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">to_c</span> <span class="ruby-comment"># =&gt; (0+0i)</span>
</pre>

                              <div class="method-source-code" id="to_c-source">
            <pre>static VALUE
nilclass_to_c(VALUE self)
{
    return rb_complex_new1(INT2FIX(0));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_f" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_f    &rarr; 0.0
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Always returns zero.</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">to_f</span>   <span class="ruby-comment">#=&gt; 0.0</span>
</pre>

                              <div class="method-source-code" id="to_f-source">
            <pre><span class="ruby-comment"># File ruby_3_3_0_preview2/nilclass.rb, line 22</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_f</span>
  <span class="ruby-keyword">return</span> <span class="ruby-value">0.0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_h" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_h &rarr; {}
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns an empty <a href="Hash.html"><code>Hash</code></a>.</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">to_h</span>   <span class="ruby-comment">#=&gt; {}</span>
</pre>

                              <div class="method-source-code" id="to_h-source">
            <pre>static VALUE
nil_to_h(VALUE obj)
{
    return rb_hash_new();
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_i" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_i &rarr; 0
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Always returns zero.</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">to_i</span>   <span class="ruby-comment">#=&gt; 0</span>
</pre>

                              <div class="method-source-code" id="to_i-source">
            <pre><span class="ruby-comment"># File ruby_3_3_0_preview2/nilclass.rb, line 10</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_i</span>
  <span class="ruby-keyword">return</span> <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_r" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_r  &rarr;  (0/1)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns zero as a Rational:</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">to_r</span> <span class="ruby-comment"># =&gt; (0/1)</span>
</pre>

                              <div class="method-source-code" id="to_r-source">
            <pre>static VALUE
nilclass_to_r(VALUE self)
{
    return rb_rational_new1(INT2FIX(0));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          to_s &rarr; &#39;&#39;
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns an empty String:</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-comment"># =&gt; &quot;&quot;</span>
</pre>

                              <div class="method-source-code" id="to_s-source">
            <pre>VALUE
rb_nil_to_s(VALUE obj)
{
    return rb_cNilClass_to_s;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-7C" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          false | object &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          nil   | object &rarr; true or false
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>false</code> if <code>object</code> is <code>nil</code> or <code>false</code>, <code>true</code> otherwise:</p>

<pre class="ruby"><span class="ruby-keyword">nil</span> <span class="ruby-operator">|</span> <span class="ruby-keyword">nil</span>        <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-keyword">nil</span> <span class="ruby-operator">|</span> <span class="ruby-keyword">false</span>      <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-keyword">nil</span> <span class="ruby-operator">|</span> <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment"># =&gt; true</span>
</pre>

                              <div class="method-source-code" id="7C-source">
            <pre>#define false_or true_and</pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

